<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<%
	request.setAttribute("title", "邀请码");
%>
<%@ include file="/WEB-INF/views/shared/master/weContentHeader.jsp"%>

<style type="text/css">

</style>
<div class="goback" data-back-point="personCenter"></div>
<input type="hidden" value="${qrCustomer.linkname}" id="refLinkname" />

<c:if test="${t_shareCode eq '' || t_shareCode==null}">
	<div style="width:100%;height:235px;background-image: url('<c:url value='/images/we/shareCode/banner.png' />');background-repeat: no-repeat;background-size:100%;">
		<div style="text-align: center;color:#fff;padding-top: 15px;font-size: 18px;">
			<div>已成功邀请<span class="num">${inviteSum}</span>人加入</div>
		    <div>分享大爱，分享财富</div>
		</div>
	</div>
	<div style="text-align: center;">
		<div style="font-size:18px;">${loginModel.nickName }</div>
		<div style="font-size:16px;">我的邀请码</div>
		<div>
			<img src="<c:url value='/admin/common/qrCode?logo=0&content=${qrUrl}' />" style="width:300px;height:300px;" />
		</div>
	</div>
</c:if>
<c:if test="${t_shareCode ne '' && t_shareCode!=null}">
	<div style="text-align: center;margin-top: 15px;">
		<div style="font-size:18px;" class="title-info">${qrCustomer.linkname}的邀请码</div>
		<div>
			<img src="<c:url value='/admin/common/qrCode?logo=0&content=${qrUrl}' />" style="width:300px;height:300px;" />
		</div>
		<div>长按识别</div>
		<div>加入普天永利，开启创富之旅</div>
	</div>
</c:if>
<%@ include file="/WEB-INF/views/shared/scripts/jquery.jsp"%>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script type="text/javascript">
$(function(){
	var shareCode="${t_shareCode}";
	var userIdentity="${userIdentity}";
	
	var url=$.getVirtualPath()+"/wechat/cust/personCenter/shareSignature";
	var linkHref=location.href.split('#')[0];
	
	var href=encodeURIComponent(linkHref);
	
	var shareCodeParam=$.isNull(shareCode)?"":"&shareCode="+shareCode;
	var resultJson=$.getJsonPost(url,"href="+href+shareCodeParam);
	
	var username=$("#refLinkname").val();
	
	if($.isNull(shareCode)){
		linkHref=linkHref.appendUrlParam("shareCode="+userIdentity);
	}
	if($.isNull(username)){
		username=resultJson.customer.linkname;
	}
	
	var config={
			debug: false,
		  	appId: resultJson.jsapiSignature.appId,// 公众号的唯一标识
		  	timestamp: resultJson.jsapiSignature.timestamp,// 生成签名的时间戳
		  	nonceStr: resultJson.jsapiSignature.nonceStr,// 生成签名的随机串
		  	signature: resultJson.jsapiSignature.signature,// 签名
		  	jsApiList: ['onMenuShareAppMessage','onMenuShareTimeline']
		}
	
	wx.config(config);

	// 微信事件
	wx.ready(function () {
		// 分享朋友
		wx.onMenuShareAppMessage({
		    title: username+'的邀请码',
		    desc:  username+'邀请您加入普天永利，开启创富之旅。',
		    link: linkHref,
		    imgUrl: 'http://www.putiyoli.net/ares/images/logo.png',
		    success: function () {
				console.log(arguments);
		    },error:function(){
		    }
		});
		
		console.log(config);
		
		wx.onMenuShareTimeline({
			title: username+'邀请您加入普天永利，开启创富之旅。',
		    link: linkHref,
		    imgUrl: 'http://www.putiyoli.net/ares/images/logo.png',
			success: function (res) {
			}
		});

		// 微信错误处理机制
		wx.error(function (res) {
			console.log(res.errMsg);
		});
		
		
	});
});
	





</script>


<%@ include file="/WEB-INF/views/shared/master/weContentFooter.jsp"%>